<template>
  <div class="provideInject">
    <slot><h2>子组件</h2></slot>
    {{user}}
  </div>
</template>

<script lang="ts">
import { Vue, Options, Prop, Inject } from 'vue-property-decorator';
@Options({ components: {} })
export default class ProvideInject extends Vue {
  @Inject()
  user!: string;
  public created() {
    // console.log('$attrs', this.$attrs);
    console.log(`Injected property: ${this.user}`);
  }
}
</script>

<style lang="postcss">
.slot{
  width: 500px;
  height: 500px;
  background-color: grey;
}
</style>
